package com.kcwl.carrier.application.assembler;


import com.kcwl.carrier.domain.entity.CarrierForeignDriverDetailInfo;
import com.kcwl.carrier.domain.entity.CarrierInfo;
import com.kcwl.carrier.domain.entity.VehicleInfo;
import com.kcwl.carrier.domain.entity.VehicleTrailerInfo;
import com.kcwl.carrier.interfaces.dto.CarrierForeignDriverDetailDto;
import com.kcwl.framework.utils.KcBeanConverter;

/**
 * @author zxx
 * @date 2022年11月30日 15:49
 * @Description 用于用户基础信息接口层和领域层的数据转换
 */
public class CarrierForeignDriverAssembler {

    /**
     * 封装司机用户认证信息
     */
    public static CarrierForeignDriverDetailDto createCarrierForeignDriver(CarrierForeignDriverDetailInfo info, CarrierInfo carrierInfo, VehicleInfo vehicleInfo, VehicleTrailerInfo vehicleTrailerInfo) {
        CarrierForeignDriverDetailDto detailDto = KcBeanConverter.toBean(info, CarrierForeignDriverDetailDto.class);
        if(carrierInfo != null){
            detailDto.setDriverName(carrierInfo.getName());
            detailDto.setDriverMobile(carrierInfo.getMobile());
            detailDto.setIdcardNo(carrierInfo.getIdcardNo());
            detailDto.setIdcardPic(carrierInfo.getIdcardPic());
            detailDto.setIdcardReversePic(carrierInfo.getIdcardReversePic());
            detailDto.setAddress(carrierInfo.getAddress());
            detailDto.setAllowDrivingModel(carrierInfo.getAllowDrivingModel());
            detailDto.setDrivingLicencePic(carrierInfo.getDrivingLicencePic());
            detailDto.setDriverQualificationPic(carrierInfo.getDriverQualificationPic());
        }
        if (vehicleInfo != null){
            detailDto.setPlateNumber(vehicleInfo.getPlateNumber());
            detailDto.setPlateNumberColor(vehicleInfo.getPlateNumberColor());
            detailDto.setLoads(vehicleInfo.getLoads());
            detailDto.setVehicleCategory(vehicleInfo.getVehicleCategory());
            detailDto.setVehicleType(vehicleInfo.getVehicleType());
            detailDto.setRoadTransCertiNumber(vehicleInfo.getRoadTransCertiNumber());
            detailDto.setRoadTransportPic(vehicleInfo.getRoadTransportPic());
            detailDto.setVehicleDrivingLicencePic(vehicleInfo.getDrivingLicensePic());
        }
        if(vehicleTrailerInfo != null){
            detailDto.setTrailerPlateNumber(vehicleTrailerInfo.getPlateNumber());
            detailDto.setTrailerPlateNumberColor(vehicleTrailerInfo.getPlateColor());
            detailDto.setTrailerTransportationFrontPic(vehicleTrailerInfo.getTransportationFrontPic());
        }
        return detailDto;
    }
}
